/**
 * Project Name:YCApiServer-Api
 * File Name:MessageService.java
 * Package Name:com.yc.music.service.service103
 * Date:2016年5月13日下午2:10:01
 * Copyright (c) 2016 
 *
 */
package com.yc.music.service.service103;

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.yc.music.common.context.YcContext;
import com.yc.music.common.util.RoomUtil;
import com.yc.music.context.YtConstant;
import com.yc.music.mapper.cache.UserCacheMapper;
import com.yc.music.mapper.dao.LyricsMapper;
import com.yc.music.mapper.dao.PushMessageFlowMapper;
import com.yc.music.mapper.dao.WorkCommentMapper;
import com.yc.music.mapper.dao.WorkFovMapper;
import com.yc.music.mapper.dao.WorkZanMapper;
import com.yc.music.model.YcPushMassageCopyrightFlowVo;
import com.yc.music.model.YcPushMassageFlowVo;
import com.yc.music.model.comment.MyCommentCenter;
import com.yc.music.model.messge.MeesageCenter;
import com.yc.music.model.musicFov.MyFovCenter;
import com.yc.music.model.musicuser.MusicUserVo;
import com.yc.music.model.weixinpay.WeixinCharge;
import com.yc.music.model.workzan.ZanCenterVo;

/**
 * ClassName: MessageService <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON(可选). <br/>
 * date: 2016年5月13日 下午2:10:01 <br/>
 *
 * @author panguixiang
 * @version 
 */
@Service
public class MessageService {
	
	private static Logger logger = Logger.getLogger(MessageService.class);

	@Autowired
	private WorkCommentMapper workCommentMapper;
	
	@Autowired
	private WorkZanMapper workZanMapper;
	
	@Autowired
	private WorkFovMapper workFovMapper;
	
	@Autowired
	private UserCacheMapper userCacheMapper;
	
	@Autowired
	private PushMessageFlowMapper pushMessageFlowMapper;
	
	@Autowired
	private LyricsMapper lyricsMapper;
	
	
	
	@Value("${Pic_QiLiu}")
	private String pIC_QiLiu;
	
	/**
	 * 
	 * center:(消息中心页面，数据). <br/> 
	 *
	 * @author panguixiang
	 * @param targetuid 用户主键id
	 * @param result
	 * @return
	 * @since JDK 1.7
	 */
	public Map<String,Object> center(Long targetuid,Map<String,Object> result) {
		int targetUserCommentCount = workCommentMapper.getNewCommentCountBytuid(targetuid,1);//评论量,1=未读
		int targetUserZanCount = workZanMapper.getWorkZanCountByTUid(targetuid, 1);//点赞量,1=未读
		int targetUserFovCount = workFovMapper.getWorkFovCountByTUid(targetuid, 1);//收藏量,1=未读
		MeesageCenter center = new MeesageCenter();
		center.setCommentnum(targetUserCommentCount);//评论
		center.setFovnum(targetUserFovCount);//收藏
		center.setZannum(targetUserZanCount);//
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,center);
		return result;
	}
	
	
	/**
	 * 
	 * center:(消息中心页面，数据). <br/> 
	 *
	 * @author panguixiang
	 * @param targetuid 用户主键id
	 * @param result
	 * @return
	 * @throws Exception 
	 * @since JDK 1.7
	 */
	public Map<String,Object> center22(Long targetuid,Map<String,Object> result) throws Exception {
		int zanCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_ZAN, 0); 
		int commentCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_COMMENT, 0); 
		int fovCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_FOV, 0); 
		
		int recommedCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_RECOMENDTOINDEX, 0); 
		int addToSongListCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_ADDTOSONGLIST, 0); 
		
		int copyrightSuccessCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_COPYRIGHSUCCESS, 0); 
		int copyrightFailCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_COPYRIGHFAIL, 0); 
		
		MeesageCenter center = new MeesageCenter();
		center.setZannum(zanCount);
		center.setCommentnum(commentCount);
		center.setFovnum(fovCount);
		//系统消息 （作品被推荐至首页消息数+作品被添加至歌单消息数）
		center.setSysmsg(recommedCount+addToSongListCount);
		//保权消息数(失败和成功的消息总数)
		center.setCopyrightnum(copyrightSuccessCount+copyrightFailCount);
		
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,center);
		return result;
	}
	
	
	public Map<String,Object> center23(Long targetuid,Map<String,Object> result) throws Exception {
		int zanCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_ZAN, 0); 
		int cooperateZanCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_ZAN_COOPERATE, 0); 
		
		int commentCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_COMMENT, 0);
		int cooperateCommentCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_COMMENT_COOPERATE, 0);
		
		int fovCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_FOV, 0); 
		int cooperateFovCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_FOV_COOPERATE, 0); 
		
		int recommedCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_RECOMENDTOINDEX, 0); 
		int addToSongListCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_ADDTOSONGLIST, 0); 
		
		int copyrightSuccessCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_COPYRIGHSUCCESS, 0); 
		int copyrightFailCount=pushMessageFlowMapper.getCountPushMessageByUidAndType(targetuid, YtConstant.PUSH_TYPE_COPYRIGHFAIL, 0); 
		
		int cooperateCount=pushMessageFlowMapper.getCooperateMsgCount23(targetuid, 0);
				
		MeesageCenter center = new MeesageCenter();
		center.setZannum(zanCount+cooperateZanCount);
		center.setCommentnum(commentCount+cooperateCommentCount);
		center.setFovnum(fovCount+cooperateFovCount);
		//系统消息 （作品被推荐至首页消息数+作品被添加至歌单消息数）
		center.setSysmsg(recommedCount+addToSongListCount);
		//保权消息数(失败和成功的消息总数)
		center.setCopyrightnum(copyrightSuccessCount+copyrightFailCount);
		
		//合作消息数（六种类型）
		center.setCooperatenum(cooperateCount);
		
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,center);
		return result;
	}
	
	/**
	 * 
	 * commentCenterList:(消息中心-评论列表). <br/> 
	 *
	 * @author panguixiang
	 * @param uid 用户id
	 * @param page
	 * @return
	 * @since JDK 1.7
	 */
	public void commentCenterList(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<MyCommentCenter> list = workCommentMapper.myCommentCenterList(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(MyCommentCenter obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUid());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());
				if(user!=null) {
					obj.setTargetname(user.getNickname());
					obj.setTargetHeader(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getAuthorid());//作者id
				obj.setAuthor(user.getNickname());
			}
		}
		workCommentMapper.setCommentIsRead(uid,0);//1=未读，0=已读
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	/**
	 * 
	 * commentCenterList:(消息中心-评论列表). <br/> 
	 *
	 * @author panguixiang
	 * @param uid 用户id
	 * @param page
	 * @return
	 * @since JDK 1.7
	 * @version v2.2
	 */
	public void commentCenterList22(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<MyCommentCenter> list = workCommentMapper.myCommentCenterList(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(MyCommentCenter obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUid());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());
				if(user!=null) {
					obj.setTargetname(user.getNickname());
					obj.setTargetHeader(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getAuthorid());//作者id
				obj.setAuthor(user.getNickname());
			}
		}
		workCommentMapper.setCommentIsRead(uid,0);//1=未读，0=已读
		//更新推送流水表的未读评论消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COMMENT, 1);
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	
	
	public void commentCenterList23(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<MyCommentCenter> list = workCommentMapper.myCommentCenterList23(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(MyCommentCenter obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUid());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());
				if(user!=null) {
					obj.setTargetname(user.getNickname());
					obj.setTargetHeader(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getAuthorid());//作者id
				obj.setAuthor(user.getNickname());
			}
		}
//		workCommentMapper.setCommentIsRead(uid,0);//1=未读，0=已读
		//更新推送流水表的未读评论消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid23(uid, YtConstant.PUSH_TYPE_COMMENT,YtConstant.PUSH_TYPE_COMMENT_COOPERATE, 1);
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	
	
	/**
	 * 
	 * zanCenterList:(消息中心-点赞列表). <br/> 
	 *
	 * @author panguixiang
	 * @param uid
	 * @param page
	 * @param result
	 * @throws Exception
	 * @since JDK 1.7
	 */
	public void zanCenterList(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<ZanCenterVo> list = workZanMapper.getZanCenterList(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(ZanCenterVo obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUser_id());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());
				if(user!=null){
					obj.setAuthor(user.getNickname());
				}
			}
		}
		workZanMapper.setZanIsRead(uid,0);//1=未读，0=已读
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	
	/**
	 * 
	 * zanCenterList:(消息中心-点赞列表). <br/> 
	 *
	 * @author panguixiang
	 * @param uid
	 * @param page
	 * @param result
	 * @throws Exception
	 * @since JDK 1.7
	 * @version V2.2
	 */
	public void zanCenterList22(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<ZanCenterVo> list = workZanMapper.getZanCenterList(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(ZanCenterVo obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUser_id());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());
				if(user!=null){
					obj.setAuthor(user.getNickname());
				}
			}
		}
		workZanMapper.setZanIsRead(uid,0);//1=未读，0=已读
		//更新推送流水表的未读点赞消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_ZAN, 1);
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	public void zanCenterList23(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<ZanCenterVo> list = workZanMapper.getZanCenterList23(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(ZanCenterVo obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUser_id());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());
				if(user!=null){
					obj.setAuthor(user.getNickname());
				}
			}
		}
//		workZanMapper.setZanIsRead(uid,0);//1=未读，0=已读
		//更新推送流水表的未读点赞消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid23(uid, YtConstant.PUSH_TYPE_ZAN,YtConstant.PUSH_TYPE_ZAN_COOPERATE, 1);
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	/**
	 * 
	 * fovMyCenterList:(消息中心-收藏列表). <br/> 
	 *
	 * @author panguixiang
	 * @param uid
	 * @param page
	 * @param result
	 * @throws Exception
	 * @since JDK 1.7
	 */
	public void fovMyCenterList(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<MyFovCenter> list = workFovMapper.fovMyCenterList(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(MyFovCenter obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUser_id());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());//作品作者
				if(user!=null){
					obj.setAuthor(user.getNickname());
				}
			}
		}
		workFovMapper.setFovIsRead(uid,0);//1=未读，0=已读
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	/**
	 * 
	 * fovMyCenterList:(消息中心-收藏列表). <br/> 
	 *
	 * @author panguixiang
	 * @param uid
	 * @param page
	 * @param result
	 * @throws Exception
	 * @since JDK 1.7
	 * @version v2.2
	 */
	public void fovMyCenterList22(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<MyFovCenter> list = workFovMapper.fovMyCenterList(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(MyFovCenter obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUser_id());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());//作品作者
				if(user!=null){
					obj.setAuthor(user.getNickname());
				}
			}
		}
		workFovMapper.setFovIsRead(uid,0);//1=未读，0=已读
		
		//更新推送流水表的未读收藏消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_FOV, 1);
		
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	
	public void fovMyCenterList23(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int start =0;
		if(page!=null && page>1) {
			start=(page-1)*10;
		}
		List<MyFovCenter> list = workFovMapper.fovMyCenterList23(uid, start, 15);
		MusicUserVo user=null;
		if(list!=null){
			for(MyFovCenter obj : list) {
				obj.setPic(RoomUtil.jointDomain(obj.getPic(),pIC_QiLiu));
				user=userCacheMapper.getCacheUservo(obj.getUser_id());
				if(user!=null){
					obj.setNickname(user.getNickname());
					obj.setHeaderurl(RoomUtil.jointDomain(user.getHeadurl(),pIC_QiLiu));
				}
				user=userCacheMapper.getCacheUservo(obj.getTarget_uid());//作品作者
				if(user!=null){
					obj.setAuthor(user.getNickname());
				}
			}
		}
//		workFovMapper.setFovIsRead(uid,0);//1=未读，0=已读
		
		//更新推送流水表的未读收藏消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid23(uid, YtConstant.PUSH_TYPE_FOV,YtConstant.PUSH_TYPE_FOV_COOPERATE, 1);
		
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	
	public void getSysMessageList22(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int rows=20;
		page=page==0?page=1:page;
		int start=(page-1)*rows;
		List<YcPushMassageFlowVo> list=pushMessageFlowMapper.getSysMessageList(uid, start, rows);
		
		//更新推送流水表的未读系统消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_NEWACTIVITY, 1);//新活动
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_ACTIVITYFINISH, 1);//活动结束
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_RECOMENDTOINDEX, 1);//推荐到首页
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_ADDTOSONGLIST, 1);//添加到歌单
		
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	
	public void getCopyrightList22(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int rows=20;
		page=page==0?page=1:page;
		int start=(page-1)*rows;
		//获取成功保权的作品推送信息
		List<YcPushMassageCopyrightFlowVo> list=pushMessageFlowMapper.getCopyrightMessageList(uid, start, rows);
		logger.info("保权消息列表:"+list.size());
		for (YcPushMassageCopyrightFlowVo vo : list) {
			if (YtConstant.PUSH_TYPE_COPYRIGHSUCCESS.equals(vo.getPushtype())) {
				vo.setTitle(YtConstant.PUSH_COPYRIGHSUCCESS_TITLE);
			}else{
				vo.setTitle(YtConstant.PUSH_COPYRIGHFAIL_TITLE);
			}
		}
		
		//更新推送流水表的未读保权消息消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COPYRIGHSUCCESS, 1);//保权成功
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COPYRIGHFAIL, 1);//保权失败
		
		
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
	
	public void getCooperateMsg23(Long uid,Integer page,Map<String,Object> result) throws Exception{
		int rows=20;
		page=page==0?page=1:page;
		int start=(page-1)*rows;
		List<YcPushMassageFlowVo> list=pushMessageFlowMapper.getCooperateMsg23(uid, start, rows);
//		for (YcPushMassageFlowVo ycPushMassageFlowVo : list) {
//			//查询歌词标题
//			String title=lyricsMapper.getCooperateMusicLyricsByItemid(ycPushMassageFlowVo.getLyricsid()).getTitle();
//			ycPushMassageFlowVo.setTitle(title);
//		}
		
		//更新推送流水表的未读系统消息为已读状态
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COOPERATE_COMPLETE, 1);//合作作品发布
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COOPERATE_INVITE, 1); //合作邀请
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COOPERATE_ACCESS, 1);//合作采纳
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COOPERATE_EXPIRE, 1);//合作过期
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COOPERATE_LEAVE, 1);//合作留言
		pushMessageFlowMapper.updatePushMessageFlowByUid(uid, YtConstant.PUSH_TYPE_COOPERATE_LEAVE_REPLY, 1);//合作留言回复
		
		result.put(YcContext.CODE, 200);
		result.put(YcContext.MESSAGE, YcContext.EMPTY_STRING);
		result.put(YcContext.DATA,list);
	}
	
}
